package io.github.cunyu1943;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 *
 * @Package : io.github.cunyu1943
 * @ClassName : Division.java
 * @CreateTime : 2022/11/27 21:01
 * @Version : 1.0
 * @Author : 村雨遥
 * @Email : 747731461@qq.com
 * @公众号 : 村雨遥
 * @Website : https://cunyu1943.github.io/JavaPark
 * @Description : 求两数的商和余数
 */
public class Division {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        System.out.println("输入被除数：");
        int num1 = in.nextInt();

        System.out.println("输入除数：");
        int num2 = in.nextInt();

        // 商
        int quotient = 0;
        // 余数
        int remainder = 0;

        while (num1 >= num2) {
            num1 -= num2;
            quotient++;
            remainder = num1;
        }

        System.out.format("两数的商是: %d, 两数的余数是: %d\n", quotient, remainder);


    }
}
